<template>
	<view>
		<view class="returnBox" @click="ret">
			<image class="returnICon" src="../../static/images/minde/arrow.png"></image>
		</view>
		<workIndex v-if="value==0"></workIndex>
		<workCompent v-if="value==1"></workCompent>
		<workMine v-if="value==2"></workMine>
		<u-tabbar :value="value" @change="change" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true"
			activeColor="#e23b17">
			<u-tabbar-item text="首页">
				<image class="u-page__item__slot-icon" slot="active-icon" src="@/static/images/tabbar/home2_.png">
				</image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="@/static/images/tabbar/home2.png">
				</image>
			</u-tabbar-item>
			<u-tabbar-item text="工作台">
				<image class="u-page__item__slot-icon" slot="active-icon" src="@/static/images/tabbar/work2.png">
				</image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="@/static/images/tabbar/work2_.png">
				</image>
			</u-tabbar-item>
			<u-tabbar-item text="我的">
				<image class="u-page__item__slot-icon" slot="active-icon" src="@/static/images/tabbar/mine2_.png">
				</image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="@/static/images/tabbar/mine2.png">
				</image>
			</u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	import {
		getAccessToken
	} from '@/utils/auth'
	import workCompent from '@/pagesA/components/workCompent/workCompent.vue'
	import workIndex from '@/pagesA/components/workIndex/workIndex.vue'
	import workMine from '@/pagesA/components/workMine/workMine.vue'
	export default {
		components: {
			workCompent,
			workIndex,
			workMine
		},
		data() {
			return {
				formData: {
					number: 0,
					reason: ''
				},
				value: 1,
			}
		},
		onLoad() {
			this.checkLogin()
			this.requestOne()
		},
		methods: {
			ret(){
				this.$tab.navigateBack(1)
			},
			change(name) {
				this.value = name
			},
			//检查登录状态
			checkLogin() {
				if (!getAccessToken()) {
					this.$tab.reLaunch('/pagesA/login')
				}
			},
			//跳转页面
			toMerchants(url) {
				if (url == '/tableCard/tableCard') {
					this.$refs.popup.open()
				} else {
					this.$tab.navigateTo('/pagesA' + url)
				}
			},
			//跳转我的
			toMine() {
				this.$tab.navigateTo('/pagesA/mine/info/index')
			},
			requestOne() {
				let that = this
				// uni.showLoading({
				// 	title: '加载中',
				// 	mask: true
				// })
				// menu().then(response => {
				// 	uni.hideLoading()
				// 	that.menus = response.data.menus
				// })
			},
		},
	}
</script>

<style>
	page {
		background-color: #F5F5F5;
	}

	.returnBox {
		width: 100rpx;
		height: 50rpx;
		position: fixed;
		top: 120rpx;
		left: 50rpx;
		z-index: 6;
	}

	.returnICon {
		width: 20rpx;
		height: 30rpx;
		transform: rotateY(180deg)
	}

	.u-page__item__slot-icon {
		width: 35rpx;
		height: 35rpx;
	}
</style>